<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <!--直接写js片段-->
        <button v-on:click="num++">点击这里</button><br/>
        <!--事件指定一个回调函数，该函数必须是Vue实例中定义的函数-->
        <button v-on:click="subduction">减少一个</button><br/>
        <button v-on:click="addNum">加一个</button><br/>
        <!-- @是v-on的简写形式 -->
        <button @click="addNum">再试试</button></button>
        <button @click="showInfo('太帅了')">点击这里精彩不断</button></button>
        <h1>他有{{num}}多少粉丝呢？</h1>
        <input type="text" @keydown="shishi">
        <input type="text" @keydown.13="shishi">
    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script type="text/javascript">
        var app = new Vue({
            el:"#app",
            data:{
                num:100
            },
            methods: {
                subduction:function(){
                    this.num--
                },
                addNum(){
                    alert(1)
                    this.num++
                },
                showInfo(info){
                    alert(info)
                },
                shishi(){
                    alert(event.keyCode)
                }
            }
        })

    </script>
</body>
</html>